package com.myidis.servlet;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.myidis.mapper.QuotaProviderMapper;
import com.myidis.entity.QuotaProvider;

@Service
public class QuotaProviderServlet {
	@Autowired
	private QuotaProviderMapper providerMapper;
	
	public List<QuotaProvider> all() {
		return providerMapper.all();
	}
	
	public QuotaProvider getOne(int id) {
		return providerMapper.getOne(id);
	}
	 
	public int insert(QuotaProvider obj) {
		return providerMapper.insert(obj);
	}
	
	public int insertAll(List<QuotaProvider> objs) {
		int count = 0;
		for (QuotaProvider obj: objs) {
			count += providerMapper.insert(obj);
		}
		return count;
	}
	
	public int update(QuotaProvider quota) {
		return providerMapper.update(quota);
	}
	
	public int delete(int id) {
		return providerMapper.delete(id);
	}
	
	public int deleteAll(int[] ids) {
		int count = 0;
		for(int id: ids)
			count += providerMapper.delete(id);
		return count;
	}
}
